package so.sao.shop.supplier.dao.app;

import org.apache.ibatis.annotations.Param;
import so.sao.shop.supplier.domain.ServiceLogistics;
import so.sao.shop.supplier.pojo.input.AppApplyForServiceInput;
import so.sao.shop.supplier.pojo.input.ServiceLogisticsInput;
import so.sao.shop.supplier.pojo.output.AppApplyForServiceOutput;
import so.sao.shop.supplier.pojo.vo.RefuseOrderImgVo;

import java.util.Date;
import java.util.List;

/**
 *<p>Version: </p>
 *<p>Title: AppApplyForServiceDao</p>
 *<p>Description:app申请售后Dao </p>
 *@author: hanchao
 *@Date: Created in 2017/11/27 10:41
 */
public interface AppApplyForServiceDao {

    /**
     * 根据detailsId查询退货退款/换货详情
     * @param detailsId
     * @return AppApplyForServiceOutput
     */
    AppApplyForServiceOutput searchApplicationDetail(@Param("detailsId") Long detailsId);

    /**
     * 根据detailsId查询图片信息
     * @param detailsId
     * @return
     */
    List<RefuseOrderImgVo> searchRefuseOrderImgs(@Param("detailsId") Long detailsId);

    /**
     * 根据detailsId查询子单以及所属的大订单
     * @param detailsId
     * @return
     */
    AppApplyForServiceOutput findDetailsItemInformation(@Param("detailsId") Long detailsId);

    /**
     * 根据orderId查询子订单return_number的数量
     * @param orderId
     * @return
     */
    Integer countOrderNumByOrderId( @Param("orderId") String orderId );

    /**
     * 退货退款/换货申请售后
     * @param appApplyForServiceInput
     */
    void insertApplicationContent(  AppApplyForServiceInput appApplyForServiceInput );

    /**
     * 上传凭证照片数据入库
     * @param refuseOrderImgVoList
     */
    void insertRefuseOrderImg( @Param("list") List<RefuseOrderImgVo> refuseOrderImgVoList );

    /**
     * 换货. 退换退款- 新增售后物流信息
     * @param serviceLogisticsInput
     */
    void insertLogisticsInformation( ServiceLogisticsInput serviceLogisticsInput );

    /**
     * 更新子订单状态(4.退款/换货中)及物流信息，退回商品时间(returnTime)
     * @param detailsId
     */
    void updataPurchaseItem(@Param("status") Integer status, @Param("returnTime") Date returnTime, @Param("detailsId") Long detailsId);

    /**
     * 根据orderId查询大订单的状态
     * @param orderId
     * @return
     */
    Integer searchApplicationDetailByOrderId(@Param("orderId") String orderId);

    /**
     * 根据orderId修改大订单的状态和退货商品时间
     * @param orderStatus
     * @param returnTime
     * @param orderId
     */
    void updataPurchaseStatusByOrderId(@Param("orderStatus") Integer orderStatus, @Param("returnTime") Date returnTime, @Param("orderId") String orderId);

    /**
     * 根据detailsId查询子订单物流信息
     * @param detailsId
     * @return
     */
    List<ServiceLogistics> searchLogisticsInformation(@Param("detailsId") Long detailsId);

}